/*
 * Created on Feb 6, 2005
 * Created by dfhuynh
 */
package edu.mit.simile.longwell;

import java.io.File;

import org.apache.log4j.Logger;

import edu.mit.simile.longwell.query.engine.QueryEngine;
import edu.mit.simile.longwell.schema.impl.LocalSchemaModel;
import edu.mit.simile.longwell.text.LocalTextIndexModel;
import edu.mit.simile.longwell.corpus.Corpus;

/**
 * @author dfhuynh
 */
public class LocalProfile extends Profile {
	final static private Logger s_logger =
		Logger.getLogger(LocalProfile.class);

	protected File m_systemDir;

	/**
	 * @param corpus
	 */
	public LocalProfile(
		String	profileID,
		Corpus 	corpus,
		File 	systemDir
	) {
		super(profileID, corpus);

		m_systemDir = systemDir;
		if (!m_systemDir.exists()) {
			m_systemDir.mkdirs();
		}

		// Create inferred model and the inferred layer model
		{
			// TODO Implement inferrence
			/*
			m_inferredModel = ModelFactory.createInfModel(
				OWLMicroReasonerFactory.theInstance().create(null),
				m_corpus.getModel());

			m_inferredLayerModel =
				((InfModel) m_inferredModel).getDeductionsModel();
			*/
			m_inferredModel = m_corpus.getModel();
			m_inferredLayerModel = null;
		}

		addStructuredModels();
	}

	protected void addStructuredModels() {
		addStructuredModel(new LocalSchemaModel(this, new File(m_systemDir, "schema")));

		addStructuredModel(new QueryEngine(this, new File(m_systemDir, "query")));

		addStructuredModel(new LocalTextIndexModel(this, new File(m_systemDir, "text-index")));
	}
}
